package 注解;

import java.lang.reflect.Constructor;

public class AnnotationProcessor {

    public static <T> T createInstance(Class<T> clazz) throws Exception {
        if (clazz.isAnnotationPresent(before.class)) {
            System.out.println(before.color);
        }
        Constructor<T> constructor = clazz.getDeclaredConstructor();
        constructor.setAccessible(true);
        return constructor.newInstance();
    }
}
